package cqrtplm.service.impl;

import java.util.List;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cqrtplm.dto.query.RtCfgDemandOrdersQueryDTO;
import cqrtplm.entity.DspfDemandDevplanDO;
import cqrtplm.entity.RtCfgDemandOrders;
import cqrtplm.mapper.RtCfgDemandOrdersMapper;
import cqrtplm.service.IRtCfgDemandOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 需求状态Service业务层处理
 *
 * @author 江小雄
 * @date 2025-06-26
 */
@Service
public class RtCfgDemandOrdersServiceImpl implements IRtCfgDemandOrdersService
{
    @Autowired
    private RtCfgDemandOrdersMapper rtCfgDemandOrdersMapper;

    /**
     * 查询需求状态
     *
     * @param category 需求状态主键
     * @return 需求状态
     */
    @Override
    public RtCfgDemandOrders selectRtCfgDemandOrdersByCategory(String category)
    {
        return rtCfgDemandOrdersMapper.selectRtCfgDemandOrdersByCategory(category);
    }


    /**
     * 新增需求状态
     *
     * @param rtCfgDemandOrders 需求状态
     * @return 结果
     */
    @Override
    public int insertRtCfgDemandOrders(RtCfgDemandOrders rtCfgDemandOrders)
    {
        return rtCfgDemandOrdersMapper.insertRtCfgDemandOrders(rtCfgDemandOrders);
    }

    /**
     * 修改需求状态
     *
     * @param rtCfgDemandOrders 需求状态
     * @return 结果
     */
    @Override
    public int updateRtCfgDemandOrders(RtCfgDemandOrders rtCfgDemandOrders)
    {
        return rtCfgDemandOrdersMapper.updateRtCfgDemandOrders(rtCfgDemandOrders);
    }

    /**
     * 批量删除需求状态
     *
     * @param categorys 需要删除的需求状态主键
     * @return 结果
     */
    @Override
    public int deleteRtCfgDemandOrdersByCategorys(String[] categorys)
    {
        return rtCfgDemandOrdersMapper.deleteRtCfgDemandOrdersByCategorys(categorys);
    }

    /**
     * 删除需求状态信息
     *
     * @param category 需求状态主键
     * @return 结果
     */
    @Override
    public int deleteRtCfgDemandOrdersByCategory(String category)
    {
        return rtCfgDemandOrdersMapper.deleteRtCfgDemandOrdersByCategory(category);
    }

    @Override
    public PageInfo<RtCfgDemandOrders> listPage(RtCfgDemandOrdersQueryDTO queryDTO, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<RtCfgDemandOrders> list = rtCfgDemandOrdersMapper.selectRtCfgDemandOrdersList(queryDTO);
        return new PageInfo<>(list);
    }
}
